/**
 * @file lv_i18n_lang.h
 *
 */

#ifndef LV_I18N_LANG_H
#define LV_I18N_LANG_H

#ifdef __cplusplus
extern "C" {
#endif

/*********************
 *      INCLUDES
 *********************/
#ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h"
#include "lv_watch_conf.h"
#else
#include "../../../lv_conf.h"
#include "../../../lv_watch_conf.h"
#endif

#if LV_USE_MULTI_I18N_LANG

#include <stdint.h>
#include "../lvgl/lvgl.h"
#include "lv_i18n.h"
#include "lv_i18n_msgid.h"

/*********************
 *      DEFINES
 *********************/
#define LV_LANG_TXT_ID_NONE     0 /*Used to not assign any text IDs for a multi-language object.*/
#define LV_SIGNAL_LANG_CHG      (255) //value should't be the one in lv_signal_t
#define WATCH_TEXT_ID_MAX       (LV_I18N_MSG_ID_MAX)

/**********************
 *      TYPEDEFS
 **********************/
enum
{
#if USE_LV_WATCH_LANG_EN != 0
    LANG_EN = 0, /* English */
#endif
#if USE_LV_WATCH_LANG_CH != 0
    LANG_CH,    /*Chinese */
#endif
#if USE_LV_WATCH_LANG_ARABIC != 0
    LANG_AR,    /*Arabic*/
#endif
};
typedef uint8_t langId_t;

typedef struct
{
    const uint8_t lang_id;
    const char *locale_name;
}lv_i18n_lang_locale_t;

typedef struct
{
    const uint16_t text_id;
    const char *msg_id;
}lv_i18n_lang_msgid_t;

/**********************
 * GLOBAL PROTOTYPES
 **********************/

/**
 * Change the language
 * @param lang_id the id of the
 */
void lv_lang_set(const uint8_t lang_id);

/**
 * Get the `txt_id` text in the set language
 * @param txt_id an ID of the text to get
 * @return the `txt_id` txt on the set language
 */
const void * lv_lang_get_text(const uint16_t txt_id);

const void * lang_get_chinese_text(uint16_t txtId);

/**
 * Return with ID of the currently selected language
 * @return pointer to the active screen object (loaded by 'lv_scr_load()')
 */
uint8_t lv_lang_act(void);

/**
 * Set a text ID which refers a the same text but in a different languages
 * @param label pointer to a label object
 * @param txt_id ID of the text
 */
void lv_label_set_text_id(lv_obj_t * label, const uint32_t txt_id);

/**********************
 *      MACROS
 **********************/

#endif /*LV_USE_MULTI_I18N_LANG*/

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /*LV_I18N_LANG_H*/
